package com.puzzlebazar.client.hashiwokakero;

import com.puzzlebazar.client.puzzle.model.Move;
import com.puzzlebazar.client.puzzle.model.MoveVisitor;
import com.puzzlebazar.client.puzzle.model.PuzzleModel;
import com.puzzlebazar.client.util.Vec2i;

public class MoveAddIsland extends MoveIsland {

	/**
	 * 
	 */
	private static final long serialVersionUID = -602635541653208409L;

	/**
	 * Only for serialization
	 */
	protected MoveAddIsland() {
		super();
	}
	
	/**
	 * Creates a move to add an island to a model
	 * 
	 * @param locX   X location of the island to add
	 * @param locY   Y location of the island to add
	 * @param value  Value of the island to add
	 */
	public MoveAddIsland(Vec2i loc,int value) {
		super(loc, value);
	}

	@Override
	public Move apply(PuzzleModel model) throws Exception {
		return createIsland(model);
	}

	@Override
	public Move unapply(PuzzleModel model) throws Exception {
		return deleteIsland(model);
	}

	@Override
	public void accept(MoveVisitor visitor) throws Exception {
		if( !(visitor instanceof HashiwokakeroMoveVisitor) ) 
			super.accept(visitor);
		else
			((HashiwokakeroMoveVisitor)visitor).visitAddIslandMove(this);
	}	
	
}
